import { BaseCmd, BaseQry, BaseView, CommonEnum, EnhancedText, MediaFile } from "@/types/global-business";
import {
  TableColumnData,
  TableData,
} from '@arco-design/web-vue/es/table/interface';
import { DepartmentView } from '@/types/idm/department';
import { ShortLinkInstanceView } from '@/types/comp/router/short-link';

export interface EmployeeSignUpLinkView extends BaseView {
  bizScope?: CommonEnum;
  type?: CommonEnum;
  companyId?: number;
  companyName?: string;
  departmentId?: number;
  departmentName?: string;
  inviterId?: number;
  inviterName?: string;
  inviterAvatar?: MediaFile;
  shortLinkInstance?: ShortLinkInstanceView;
}

export interface EmployeeSignUpLinkCmd extends BaseCmd {
  linkType?: any;
  companyId?: number;
  departmentId?: number;
}

export interface EmployeeExpand {
  personId: number; // 自然人ID，实名认证后有值")
  inviterId: number; // 邀请人ID
  operationLog: any; // 状态流转日志
}

export interface EmployeeView extends BaseView {
  primaryId?: number; // 主帐号ID
  secondaryId?: number; // 业务帐号ID
  federalId?: number; // 联邦业务帐号ID
  companyId?: number; // 公司ID
  departmentId?: number; // 员工所属部门ID，每个员工都会就职于某个部门
  type?: CommonEnum; // 类型
  status?: CommonEnum; // 状态: 已入职｜审核中｜已拒绝｜已离职
  code?: string; // 工号
  name?: string; // 员工姓名
  phone?: string; // 员工手机号码
  avatar?: MediaFile; // 员工头像
  gender?: CommonEnum; // 员工性别 1男 0女
  entryTime?: Date; // 员工入职时间
  expand?: EmployeeExpand; // 员工上下文信息
  department?: DepartmentView;
}

export interface EmployeeUptCmd extends BaseCmd {
  companyId?: number;
  id?: number;
  name?: string;
  avatar?: MediaFile;
  gender?: any;
  entryTime?: Date;
}

export interface EmployeeStatusUptCmd extends BaseCmd {
  from?: any;
  to?: any;
  translationReason?: EnhancedText;
  companyId?: number;
  id?: number;
  entryTime?: Date;
  departmentId?: number;
  roleIdList?: number[];
}

export interface EmployeeQry extends BaseQry {
  secondaryId?: number;
  companyId?: number;
  id?: number;
  status?: any;
}

export interface EmployeePageQry extends BaseQry {
  companyId?: number;
  keyword?: string;
  position?: string; // 职位名称搜索
  statusList?: any[];
  departmentId?: number;
  departmentIdList?: number[];
  fetchDepartment?: boolean;
}

export const EMPLOYEE_COLUMNS: TableColumnData[] = [
  {
    title: '序号',
    dataIndex: 'idx',
    width: 60,
    fixed: 'left',
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 120,
  },
  {
    title: '工号',
    dataIndex: 'code',
    width: 120,
  },
  {
    title: '姓名',
    dataIndex: 'name',
    width: 120,
  },
  {
    title: '手机号',
    dataIndex: 'phone',
    width: 200,
  },
  {
    title: '部门',
    dataIndex: 'departmentId',
    width: 200,
  },
  {
    title: '性别',
    dataIndex: 'gender',
    width: 60,
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: 200,
    fixed: 'right',
  },
];
